﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;

namespace FzWeb.Models
{
    public class PersonSearch
    {
        /*
         * @VocationId varchar(300)=null,       --期望行业
@PostClassId varchar(300)=null,      --期望职位
@PostType varchar(20)=null,          --职位性质,'全职,兼职'
@WorkAreaId varchar(300)=null,       --期望工作地点
@LastUpdate int =null,               --简历更新时间
@AgeFrom int=null,                   --年龄
@AgeTo  int=null,
@IsPic bit=null,                     --有相片简历 bool型
@Sex int=null,                       --性别 1男 2女 0不限
@Education varchar(100)=null,        --学历
@WorkLength int=null,                --工作年限
@ResidenceId varchar(100)=null,      --户籍
@MonthSalary varchar(100)=null,      --月薪范围
@KeyWord varchar(500)=null           --关键字
         * salary1
         * salary2
         * 
         */

        private string _vocationid;
        private string _postclassid;
        private string _posttype;
        private string _LocationId;
        private int _lastupdate;
        private int _agefrom;
        private int _ageto;
        private bool _ispic;
        private int _sex;
        private string _education;
        private int _worklength;
        private string _residenceid;
        private string _monthsalary;
        private string _keyword;
        private string _keywordtype;

        public string Keywordtype
        {
            get { return _keywordtype; }
            set { _keywordtype = value; }
        }
        private int _salary1;
        private int _salary2;

        public int Salary2
        {
            get { return _salary2; }
            set { _salary2 = value; }
        }

        public int Salary1
        {
            get { return _salary1; }
            set { _salary1 = value; }
        }



        public string PostClassId 
        {
            get { return _postclassid; }
            set { _postclassid = value; }
        }

        public string Keyword
        {
            get { return _keyword; }
            set { _keyword = value; }
        }

        public string Monthsalary
        {
            get { return _monthsalary; }
            set { _monthsalary = value; }
        }

        public string Residenceid
        {
            get { return _residenceid; }
            set { _residenceid = value; }
        }

        public int Worklength
        {
            get { return _worklength; }
            set { _worklength = value; }
        }

        public string Education
        {
            get { return _education; }
            set { _education = value; }
        }

        public int Sex
        {
            get { return _sex; }
            set { _sex = value; }
        }

        public bool Ispic
        {
            get { return _ispic; }
            set { _ispic = value; }
        }

        public int Ageto
        {
            get { return _ageto; }
            set { _ageto = value; }
        }

        public int Agefrom
        {
            get { return _agefrom; }
            set { _agefrom = value; }
        }

        public int Lastupdate
        {
            get { return _lastupdate; }
            set { _lastupdate = value; }
        }

        public string LocationId
        {
            get { return _LocationId; }
            set { _LocationId = value; }
        }

        public string PostType
        {
            get { return _posttype; }
            set { _posttype = value; }
        }

        public string VocationId
        {
            get { return _vocationid; }
            set { _vocationid = value; }
        }
        private string _VocationName;

        public string VocationName
        {
            get { return _VocationName; }
            set { _VocationName = value; }
        }
        private string _PostClassName;

        public string PostClassName
        {
            get { return _PostClassName; }
            set { _PostClassName = value; }
        }
        private string _Location;

        public string Location
        {
            get { return _Location; }
            set { _Location = value; }
        }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            if(!string.IsNullOrEmpty(VocationName))
            {
                sb.Append(VocationName);
            }
            if (!string.IsNullOrEmpty(PostClassName))
            {
                sb.Append(" + " +PostClassName);
            }
            if (!string.IsNullOrEmpty(PostType))
            {
                string[] str = PostType.Split(',');
                string s = (str[0] == "'true'" ? "全职," : "") + (str[1] == "'true'" ? "兼职," : "") + (str[2] == "'true'" ? "实习" : "");
                sb.Append(" + " + s);
            }
            if (!string.IsNullOrEmpty(Location))
            {
                sb.Append(" + " + Location);
            }
            if (Lastupdate != 0)
            {
                sb.Append(" + " + Lastupdate + "天内");
            }
            if (Agefrom != 0)
            {
                sb.Append(" + 年龄:" + Agefrom +"-"+Ageto);
            }
            if (Ispic)
            {
                sb.Append(" + 有相片");
            }
            if (Sex != 0)
            {
                sb.Append(" + "+ (Sex == 1?"男":"女"));
            }
            if (!string.IsNullOrEmpty(Education))
            {
                sb.Append(" + " + Education);
            }
            if (Worklength != 0)
            {
                sb.Append(" + " + Worklength + "年以上");
            }
            
            return sb.ToString();
        }
    }
}
